package mattkrutsick.android.fitnesstracker;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.widget.ProgressBar;
import android.widget.TextView;

public class SplashScreenActivity extends Activity{
    /** Called when the activity is first created. */

    
    SQLiteDatabase db=null;
	TextView tv;
	ProgressBar pb;
	ArrayList<String> splashlist=new ArrayList<String>();
	int x=0;
	int progress=0;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        //creating reference to the textview on the screen
        tv=(TextView)findViewById(R.id.textView1);
        pb=(ProgressBar)findViewById(R.id.progressBar1);
        fillSplashList();
        
        
        
        //Starts a countdown timer to move to home screen
        new CountDownTimer(3500,500){

			@Override
			public void onFinish() {
				 startActivity(new Intent(SplashScreenActivity.this, HomeScreenActivity.class));
				 SplashScreenActivity.this.finish();
			}

			@Override
			public void onTick(long arg0) {	
				pb.setProgress(progress);
				tv.setText(splashlist.get(x++));
				progress+=20;
			}
        	
        }.start();
     }
    
    /*
     * Method to fill the array list which displays text on the
     * splash screen
     */
    private void fillSplashList(){
    	splashlist.add("By: Krut Dev...");
    	splashlist.add("By: Krut Dev...");
        splashlist.add("Opening Databases...");
        splashlist.add("Loading UI...");
        splashlist.add("Loading DATA...");
        splashlist.add("Starting Fitness Tracker...");
    }
    
    
    
}